package com.moi.command;

public class TurnOnReceiver extends Receiver {

    private final TurnOnCommand turnOnCommand=new TurnOnCommand();
    public  TurnOnReceiver(){
        super.setCommand(new TurnOnCommand());//方法 1 接收者每次都创建命令对象
        super.setCommand(turnOnCommand);//方法 2 初始化一个命令对象 避免多次创建对象

    }
    @Override
    public void execute() {
        super.getCommand().work();
    }
}
